package com.hontech.bvapp2.ui.parts.heat

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.Button
import android.widget.FrameLayout
import com.hontech.bvapp2.R
import com.hontech.bvapp2.device.cp.Heat
import com.hontech.bvapp2.ui.dialog.runProg
import com.hontech.bvapp2.utils.onClick

class HeatStirMotorParts (context: Context, attrs: AttributeSet) : FrameLayout(context, attrs) {

    init {
        val view = LayoutInflater.from(context).inflate(R.layout.parts_heat_stir_motor, this)
        val open = view.findViewById<Button>(R.id.id_heat_stir_motor_btn_open)
        val close = view.findViewById<Button>(R.id.id_heat_stir_motor_btn_close)

        open.onClick {
            runProg("搅拌电机", "打开") {
                Heat.stirMotorCtrl(0)
            }
        }

        close.onClick {
            runProg("搅拌电机", "关闭") {
                Heat.stirMotorCtrl(1)
            }
        }

    }
}